/*
 * Copyright (c) 2013-2015 Charkey. All rights reserved.
 *
 * This software is the confidential and proprietary information of Charkey.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the agreements you entered into with Charkey.
 *
 * Charkey MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
 *
 * Charkey SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
 * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

package cn.simastudio.talos.ucpaas.model;

import com.alibaba.fastjson.JSON;

/**
 * 调用发送短信接口的请求内容，new TemplateSMS，设置完属性后，调用{@link TemplateSMS#toSMSContent()}
 */
public class TemplateSMS {

    /**
     * <p>应用ID</p>
     * <p>查看路径：开发者控制台->应用管理->应用列表->对应的应用->管理，即可看到应用ID</p>
     */
    private String appId;

    /**
     * <p>短信模板ID</p>
     * <p>查看路径：开发者控制台->应用管理->短信管理->对应应用下的短信模板ID</p>
     */
    private String templateId;

    /**
     * 短信接收端手机号码（国内短信不要加前缀，国际短信号码前须带相应的国家区号，如日本：0081）
     */
    private String to;

    /**
     * <p>内容数据，用于替换模板中{数字}，若有多个替换内容，用英文逗号隔开即可</p>
     * <p>如：短信验证码为{1}，请在{2}分钟内输入。==> 则，param应为 1234,5 </p>
     */
    private String param;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        this.param = param;
    }

    /**
     * 直接将设置了各个参数后的templateSMS转为JSON，再拼接上必要的部分，使之成为短信接口需要的请求内容
     *
     * @return 短信接口请求内容
     */
    public String toSMSContent() {
        return "{\"templateSMS\":" + JSON.toJSONString(this) + "}";
    }

}
